#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "Q1mi"
# Date: 2018/11/2

######从数据库获取预警数据
from travel_weater import sql

def warn_sql():
    sql_str = "select substring(cast(t.description as varchar(500)),charindex('解除',cast(t.description as varchar))+3,6) from STRONG_Country_WarningDataAll t where t.description  like '%分解%' and t.sender = '筠连县气象局' and t.addTime >= '2018-09-20'
"
    sql_data = sql.Sql(server = "strongdc.sqlserver.rds.aliyuncs.com:3433",user= "strong",password = "3686e342")
    obtain_data = sql_data.Obtain_sql(sql_str)
    print(obtain_data)
#where sender like '%石河子%' and sendTime >= '2018-10-15 11:28:00' and description not like '%解除%'
#select  SUBSTR(t.description,3) from STRONG_Country_WarningDataAll t where t.description  like '%分解%' and t.sender = '筠连县气象局' and t.addTime >= '2018-09-20'
if __name__ == '__main__':
    warn_sql()
